/*
 * @Author: BuddyCoder
 * @Date: 2022-03-30 10:22:31
 * @LastEditTime: 2022-03-30 14:43:15
 * @LastEditors: BuddyCoder
 * @Description: 
 * @FilePath: /venom_log/src/plugin/file_loop.rs
 * MIT
 */

 use crate::appender::{VenomLogRecord, LogAppender};
 use crate::consts::LogSize;
 use crate::plugin::file_split::{FileSplitAppender, RollingType};
 use crate::plugin::packer::LogPacker;
 
 /// 单日志存储方式循环存储，Single logs are stored in rolling mode by capacity
 pub struct FileLoopAppender {
     file: FileSplitAppender,
 }
 
 impl FileLoopAppender {
     pub fn new(log_file_path: &str, max_temp_size: LogSize) -> FileLoopAppender {
         Self {
             file: FileSplitAppender::new(log_file_path, max_temp_size, RollingType::KeepNum(0), Box::new(LogPacker {}))
         }
     }
 }
 
 impl LogAppender for FileLoopAppender {
     fn do_log(&self, record: &VenomLogRecord) {
         self.file.do_log(record);
     }
 }